<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="js/vue.js"></script>
	</head>
	<body>
		<div id="app">
			<button @click="update">修改</button>
			<button @click="get">收集</button>
			<p>用户姓名<input type="text" v-model="uname" id='uname'/></p>
			<p>用户年龄<input type="text" v-model="age" /></p>
			<p>用户性别<input type="radio" name="sex" value="man" v-model="sex" />男
				<input type="radio" name="sex" value="woman" v-model="sex" />女
			</p>
			<p>用户爱好<input type="checkbox" name="hobby" value="html" v-model="hobby" />HTML
				<input type="checkbox" name="hobby" value="css" v-model="hobby" />CSS
				<input type="checkbox" name="hobby" value="js" v-model="hobby" />JS
			</p>
			<h2>{{uname}}</h2>
			<h2>{{age}}</h2>
		</div>
		<script type="text/javascript">
			const vm = new Vue({
				el: '#app',
				data: {
					uname: '张三',
					age: 20,
					sex: 'woman',
					hobby: ['css', 'js']
				},
				methods: {
					update() {
						this.uname = "李四";
					},
					get() {
						console.log(this.uname, this.age, this.sex, this.hobby);
					}
				}
			})
		</script>
	</body>
</html>
